﻿/**
<code>
  <author name="Zealic" email="zealic(at)gmail.com" type="Creator"/>
</code>
**/
using System;


namespace Zealib.Transform
{
    /// <summary>
    /// Object transformer interface.
    /// </summary>
    public interface ITransformer
    {
        /// <summary>
        /// Check can source transform as <typeparamref name="TDestiation"/>.
        /// </summary>
        /// <typeparam name="TDestiation">Destiation type.</typeparam>
        /// <returns>If can transform return true.</returns>
        bool CanTransformTo<TDestiation>();

        /// <summary>
        /// Check can transform destiation as <typeparamref name="TSource"/>.
        /// </summary>
        /// <typeparam name="TSource">Source type.</typeparam>
        /// <returns>If can transform return true.</returns>
        bool CanTransformBack<TSource>();

        /// <summary>
        /// Transform source as <typeparamref name="TDestiation"/>.
        /// </summary>
        /// <typeparam name="TDestiation">Destiation type.</typeparam>
        /// <param name="source">Source object.</param>
        /// <returns>Transformed destiation object.</returns>
        TDestiation TransformTo<TDestiation>(object source);

        /// <summary>
        /// Transform destiation as <typeparamref name="TSource"/>.
        /// </summary>
        /// <typeparam name="TSource">Source type.</typeparam>
        /// <param name="destiation">Destiation object.</param>
        /// <returns>Transformed source object.</returns>
        TSource TransformBack<TSource>(object destiation);

    }
}
